﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Graphics;
namespace Scavenger.VectorStuff
{
    class Circle
    {
        private Vector2 p_Centroid;
        private float p_Radius;
        public Vector2 Centroid { get { return p_Centroid; } }
        public float Radius { get { return p_Radius; } }

        public Circle(Vector2 centroid, float radius)
        {
            p_Centroid = centroid;
            p_Radius = radius;
        }

        public void Update(Vector2 centroid)
        {
            p_Centroid = centroid;
        }

        public void Update(float radius)
        {
            p_Radius = radius;
        }

        public float DistanceToCircle(Vector2 point)
        {
            Vector2 BetweenVector = VectorMath.PointsToVector(point, p_Centroid);
            float Distance = BetweenVector.Length() - p_Radius;
            return Distance;
        }

        public Vector2 ClosestPointOnCircle(Vector2 point)
        {
            Vector2 BetweenVector = VectorMath.PointsToVector( p_Centroid, point);
            BetweenVector.Normalize();
            Vector2 ClosestPoint = p_Centroid + BetweenVector * p_Radius;
            return ClosestPoint;
        }



    }
}
